// Package entity
// @Author: zhangdi
// @File: sys_dic
// @Version: 1.0.0
// @Date: 2023/9/4 16:47
package entity

import (
	"path/filepath"
	"server/application/db/schema/dbops"
	"time"
)

// SysDictionary 字典实体
type SysDictionary struct {
	ID            uint      `gorm:"primaryKey"`
	DicValueType  string    `gorm:"comment:字典值类型;size:255"`
	ValueDataType string    `gorm:"comment:值类型;size:10"`
	DicKey        string    `gorm:"comment:Key;uniqueIndex;size:100"`
	DicValue      string    `gorm:"comment:字典值"`
	Description   string    `gorm:"comment:描述;size:255"`
	IsActive      bool      `gorm:"comment:是否启用;default:true"`
	DicSort       int       `gorm:"comment:字典排序;default:100"`
	CreatedAt     time.Time `gorm:"comment:创建时间"`
	UpdatedAt     time.Time `gorm:"comment:更新时间"`
}

// GenConfig 生成相关配置
func (u SysDictionary) GenConfig() dbops.EntityConfig {
	return dbops.EntityConfig{
		Title:             "字典",
		AsName:            "",                         //实体别名，请使用大驼峰命名法
		ViewsFatherFolder: filepath.Join("developer"), //视图父目录
	}
}
